package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-07-06
 * Time: 17:33
 */
class A {
    public void func1() {
        System.out.println("父类中的func1方法");
    }
    public int func2() {
        System.out.println("父类中func2方法");
        return 0;
    }
    public void func3() {
        System.out.println("父类中func3方法");
    }
}
class B extends A {
    public void func1() {
        System.out.println("子类中func1方法");
    }

    //编译出错
/*    public void func2() {
        System.out.println("子类中func2方法");
    }*/

    public void func3(int x) {
        System.out.println("父类中func3方法");
    }
}
public class TestDemo2 {
    public static void main(String[] args) {
        B b = new B();
        b.func1();
        b.func2();
        b.func3();
        b.func3(1);
    }
}
